<template>
    <div class="app-container">
        <el-card class="box-card" shadow="always" v-show="showSearch">
            <el-form :model="queryParams" ref="queryForm"  :inline="true" label-width="68px" @submit.native.prevent>
                <el-form-item label="品牌名称" prop="brandName">
                    <el-input v-model="queryParams.brandName" placeholder="请输入品牌名称" clearable
                        @keyup.enter="handleQuery" />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary"   @click="handleQuery">搜索</el-button>
                    <el-button  @click="resetQuery">重置</el-button>
                </el-form-item>
            </el-form>
        </el-card>

        <el-card shadow="always" :body-style="{ padding: '20px' }" style="margin-top: 10px;">
            <!-- <div slot="header">
            <span></span>
        </div> -->
            <!-- card body -->
            <el-row :gutter="10" class="mb8">
                <el-col :span="1.5">
                    <el-button type="primary"    @click="handleAdd"
                        v-hasPermi="['order:goodsBrand:add']">添加品牌
                    </el-button>
                </el-col>
                <el-col :span="1.5">
                    <el-button type="danger" :disabled="!multiple"
                        @click="handleBatchDelete" v-hasPermi="['order:goodsBrand:remove']">删除
                    </el-button>
                </el-col>
                <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
            </el-row>

            <el-table v-loading="loading" :data="dataSource" @selection-change="handleSelectionChange" size="large">
                <el-table-column type="selection" width="55" align="center" :selectable="selectHandle" />
                <el-table-column label="#" type="index"> </el-table-column>
                <el-table-column label="品牌名称" align="center" prop="brandName" width="150"/>
                <el-table-column label="排序" align="center" prop="sort" width="80" />
                <el-table-column label="创建时间" align="center" prop="createTime" />
                <el-table-column label="状态" align="center" prop="brandStatus" >
                    <template #default="scope">
                        <el-tag :type="scope.row.brandStatus == 1 ? 'success' : 'danger'">
                            {{ scope.row.brandStatus == 1 ? '正常' : '隐藏' }}
                        </el-tag>
                    </template>

                </el-table-column>
                <el-table-column label="操作" align="center">
                    <template #default="scope">
                        <el-button v-hasPermi="['order:goodsBrand:edit']" type="text"  @click="handleEdit(scope.row)">编辑</el-button>
                        <el-divider v-hasPermi="['order:goodsBrand:edit']" direction="vertical"></el-divider>
                        <el-button v-hasPermi="['order:goodsBrand:remove']" type="text"  @click="handleDelete(scope.row.id)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <pagination v-show="total > 0" :total="total" v-model:page.sync="queryParams.pageNum"
                v-model:limit.sync="queryParams.pageSize" @pagination="getList" />
        </el-card>
        <addForm ref="modelForm" @ok="getList"></addForm>
    </div>
</template>
  
<script>
import addForm from './modules/addForm.vue';
import listMixin from '@/mixins/listMixin';
export default {
    name: "category",
    dicts: ["inventory_status", "counting_method"],
    components: {
        addForm
    },
    mixins: [listMixin],
    data() {
        return {
            queryParams: {
                orderNo: '',
                pageNum: 1,
                pageSize: 10
            },
            urls:{
                list: '/order/goodsBrand/list',
                delete: '/order/goodsBrand',
            },
        }; 
    },
};
</script>
  